package com.zj.study.utils.validation.validator.pattern;


import com.zj.study.utils.validation.annotation.ValidateSupport;
import com.zj.study.utils.validation.annotation.constraint.Pattern;
import org.springframework.lang.NonNull;

/**
 * @author 谭耀飞
 * @since 2020.12.0
 */
@ValidateSupport(String.class)
public class PatternValidatorForString extends AbstractPatternValidator<String> {

  @Override
  boolean compare(@NonNull Pattern pattern, @NonNull String value) {
    return java.util.regex.Pattern.matches(pattern.value(), value);
  }

}
